package com.ms.log.event;

import com.ms.log.level.Level;

/**
 * @author zdh
 * 每次日志记录，都是一次输出，基于事件驱动模式 输出日志，提高系统性能，
 * 因此命令为 LogEvent
 */
public class LogEvent {

        /**
         * 日志时间戳
         */
        public long timestamp;
        /**
         * 日志级别
         */
        private Level level;
        /**
         * 日志消息
         */
        private Object message;
        /**
         * 线程名称
         */
        private String threadName;
        /**
         * 线程id
         */
        private long threadId;
        /**
         * 日志名称，被记录日志的对象名称
         */
        private String loggedName;


        public LogEvent(){}
        public LogEvent(Level level, String message, String loggeredName){
                this.level = level;
                this.message = message;
                this.loggedName = loggeredName;
        }


        public long getTimestamp() {
                return timestamp;
        }

        public void setTimestamp(long timestamp) {
                this.timestamp = timestamp;
        }

        public Level getLevel() {
                return level;
        }

        public void setLevel(Level level) {
                this.level = level;
        }

        public Object getMessage() {
                return message;
        }

        public void setMessage(Object message) {
                this.message = message;
        }

        public String getThreadName() {
                return threadName;
        }

        public void setThreadName(String threadName) {
                this.threadName = threadName;
        }

        public long getThreadId() {
                return threadId;
        }

        public void setThreadId(long threadId) {
                this.threadId = threadId;
        }

        public String getLoggedName() {
                return loggedName;
        }

        public void setLoggedName(String loggedName) {
                this.loggedName = loggedName;
        }

        @Override
        public String toString() {
            return "LogEvent{" +
                    "timestamp=" + timestamp +
                    ", level=" + level +
                    ", message=" + message +
                    ", threadName='" + threadName + "'" +
            ", threadId=" + threadId +
                    ", loggeredName='" + loggedName + "'" +
            '}';
        }

}
